﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Validation.aspx.cs" Inherits="ShoppingApp.Validation" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div class="validationContent" style="height: 300px; position: relative">
        <asp:TextBox ID="TextEmailTextBox" runat="server" height="22px" 
            style="z-index: 1; left: 0px; top: 0px; position: absolute" width="128px"></asp:TextBox>
        <asp:TextBox ID="NumberTextBox" runat="server" 
            style="z-index: 1; left: 0px; top: 48px; position: absolute" width="128px" 
            height="22px"></asp:TextBox>
        <asp:TextBox ID="PrefferedDateTextBox" runat="server" height="22px" 
            style="z-index: 1; left: 0px; top: 88px; position: absolute" width="128px"></asp:TextBox>
        <asp:Label ID="Label1" runat="server" Text="Label" 
            style="height: 16px; z-index: 1; left: 243px; top: 151px; position: absolute;"></asp:Label>
        <asp:Button ID="Button1" runat="server" Text="Button" 
            
            style="z-index: 1; left: 87px; top: 144px; position: absolute; width: 80px" 
            onclick="Button1_Click" ValidationGroup="AllValidators"/>
        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
            ControlToValidate="TextEmailTextBox" Display="Dynamic" 
            ErrorMessage="E-mail address is required" ForeColor="Red" 
            style="z-index: 1; left: 140px; top: 4px; position: absolute" 
            ValidationGroup="AllValidators">*</asp:RequiredFieldValidator>
        <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
            ControlToValidate="TextEmailTextBox" Display="Dynamic" 
            ErrorMessage="E-mail address must be in correct format with @" 
            style="z-index: 1; left: 169px; top: 3px; position: absolute" 
            ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" 
            ValidationGroup="AllValidators">Invalid format</asp:RegularExpressionValidator>
        

        <asp:ValidationSummary ID="ValidationSummary1" runat="server" 
            
            style="z-index: 1; left: -1px; top: 209px; position: absolute; height: 34px; width: 920px" 
            ShowMessageBox="True" ValidationGroup="AllValidators" />
        <asp:CustomValidator ID="CustomValidator1" runat="server" Display="Dynamic" 
            ErrorMessage="Both fields should contain the same value" 
            onservervalidate="CustomValidator1_ServerValidate" 
            style="z-index: 1; left: 176px; top: 48px; position: absolute" 
            ValidationGroup="AllValidators"></asp:CustomValidator>
        </div>

        <div style="width: 308px; margin-left: 100px">
        <asp:ListView ID="ListView1" runat="server" DataSourceID="SqlDataSource1" 
                style="top: 427px; left: 176px; height: 249px; width: 308px">
            <AlternatingItemTemplate>
                <tr style="background-color: #FFFFFF; color: #284775;">
                    <td>
                        <asp:Label ID="CityLabel" runat="server" Text='<%# Eval("City") %>' />
                    </td>
                    <td>
                        <asp:Label ID="StreetLabel" runat="server" Text='<%# Eval("Street") %>' />
                    </td>
                </tr>
            </AlternatingItemTemplate>
            <EditItemTemplate>
                <tr style="background-color: #999999;">
                    <td>
                        <asp:Button ID="UpdateButton" runat="server" CommandName="Update" 
                            Text="Update" />
                        <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                            Text="Cancel" />
                    </td>
                    <td>
                        <asp:TextBox ID="CityTextBox" runat="server" Text='<%# Bind("City") %>' />
                    </td>
                    <td>
                        <asp:TextBox ID="StreetTextBox" runat="server" Text='<%# Bind("Street") %>' />
                    </td>
                </tr>
            </EditItemTemplate>
            <EmptyDataTemplate>
                <table runat="server" 
                    style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;">
                    <tr>
                        <td>
                            No data was returned.</td>
                    </tr>
                </table>
            </EmptyDataTemplate>
            <InsertItemTemplate>
                <tr style="">
                    <td>
                        <asp:Button ID="InsertButton" runat="server" CommandName="Insert" 
                            Text="Insert" />
                        <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                            Text="Clear" />
                    </td>
                    <td>
                        <asp:TextBox ID="CityTextBox" runat="server" Text='<%# Bind("City") %>' />
                    </td>
                    <td>
                        <asp:TextBox ID="StreetTextBox" runat="server" Text='<%# Bind("Street") %>' />
                    </td>
                </tr>
            </InsertItemTemplate>
            <ItemTemplate>
                <tr style="background-color: #E0FFFF; color: #333333;">
                    <td>
                        <asp:Label ID="CityLabel" runat="server" Text='<%# Eval("City") %>' />
                    </td>
                    <td>
                        <asp:Label ID="StreetLabel" runat="server" Text='<%# Eval("Street") %>' />
                    </td>
                </tr>
            </ItemTemplate>
            <LayoutTemplate>
                <table runat="server">
                    <tr runat="server">
                        <td runat="server">
                            <table ID="itemPlaceholderContainer" runat="server" border="1" 
                                style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;font-family: Verdana, Arial, Helvetica, sans-serif; width: 308px">
                                <tr runat="server" style="background-color: #E0FFFF; color: #333333;">
                                    <th runat="server">
                                        City</th>
                                    <th runat="server">
                                        Street</th>
                                </tr>
                                <tr ID="itemPlaceholder" runat="server">
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr runat="server">
                        <td runat="server" 
                            style="text-align: center;background-color: #5D7B9D; font-family: Verdana, Arial, Helvetica, sans-serif;color: #FFFFFF;">
                            <asp:Button Text="This is button" runat="server"/>
                            <asp:DataPager ID="DataPager1" runat="server">
                                <Fields>
                                    <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" 
                                        ShowNextPageButton="False" ShowPreviousPageButton="False" />
                                    <asp:NumericPagerField />
                                    <asp:NextPreviousPagerField ButtonType="Button" ShowLastPageButton="True" 
                                        ShowNextPageButton="False" ShowPreviousPageButton="False" />
                                </Fields>
                            </asp:DataPager>
                        </td>
                    </tr>
                </table>
            </LayoutTemplate>
            <SelectedItemTemplate>
                <tr style="background-color: #E2DED6; font-weight: bold;color: #333333;">
                    <td>
                        <asp:Label ID="CityLabel" runat="server" Text='<%# Eval("City") %>' />
                    </td>
                    <td>
                        <asp:Label ID="StreetLabel" runat="server" Text='<%# Eval("Street") %>' />
                    </td>
                </tr>
            </SelectedItemTemplate>
        </asp:ListView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:ShoppingAppDbConnectionString %>" 
            SelectCommand="SELECT [City], [Street] FROM [Addresses]">
        </asp:SqlDataSource>
    </div>
                        
</asp:Content>
